const express = require('express')
    // 创建路由对象
const router = express.Router()
    // 导入用户路由处理函数模块
const goodslistHandler = require('../router_handler/goodList')

const { reg_edituser_schema } = require('../schema/manager')
const expressJoi = require('@escook/express-joi')
    // // 1. 导入验证表单数据的中间件
    // const expressJoi = require('@escook/express-joi')
    // // 2. 导入需要的验证规则对象
    // const { reg_user_schema,reg_editUser_schema } = require('../schema/manager')

//商品添加
router.post('/goods', goodslistHandler.addGoods)
    //分类参数管理,参数列表
router.get('/categories/:id/attributes', goodslistHandler.getAttributes)


//根据用户id查询用户信息
router.get('/goods/:id', goodslistHandler.searchGoodById)

//编辑用户
router.put("/goods/:id", expressJoi(reg_edituser_schema), goodslistHandler.editGoodById)


//获取商品列表
router.get('/goods', goodslistHandler.getGoodsList)
    //根据id删除商品数据
router.delete('/goods/:id', goodslistHandler.deleteGoods)
    // //根据用户id查询用户信息
    // router.get('/users/:id', managerHandler.searchUserById)
    // //编辑用户
    // router.put("/users/:id", expressJoi(reg_edituser_schema), managerHandler.editUserById)
    // 将路由对象共享出去
module.exports = router